<template>
	<page-meta>
		<navigation-bar title="文章收藏" background-color="#354e44" />
	</page-meta>
	
	
		<view class="artical">
			<view v-if="!articalArr.length">抱歉暂无收藏</view>
			<block v-else>
				<view @tap="goToArticalDetail(item.id)" class="artical-detail" v-for="item in articalArr" :key="item.id">
					<image class="artical-detail-img" :src="item.coverImg" ></image>
					<view class="artical-detail-title">{{item.title}}</view>
					
				</view>
			</block>
		</view>

</template>

<script>
	export default {
		data() {
			return {
				articalArr: []
			}
		},
		onLoad() {
			this.articalArr = uni.getStorageSync('articalArr') ? uni.getStorageSync('articalArr') : [];
			console.log('文章收藏', this.articalArr);
		},
		methods: {
			//跳转到文章详情
			goToArticalDetail(articalId){
				uni.navigateTo({
					url:`../../find/articalDetail/articalDetail?articalId=${articalId}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	
.artical{
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	width: 100%;
	height: 100%;
	min-height: 100vh;
	align-content:flex-start;
	box-sizing: border-box;
	padding: 30rpx;
	background-color: #f1ece7;
	&-detail{
		display: flex;
		overflow: hidden;
		flex-direction: column;
		align-items: center;
		width: 334rpx;
		height: 322rpx;
		border-radius: 15rpx;
		background-color: #FFFFFF;
		margin-bottom: 30rpx;
		&-img{
			display: block;
			width: 334rpx;
			height: 238rpx;
		}
	}
}
</style>
